/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package boundless.ejb;

import boundless.entities.*;
import java.util.logging.Logger;
import javax.annotation.PostConstruct;
import javax.ejb.*;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.criteria.CriteriaBuilder;
/**
 *
 * @author Matt
 */
@Singleton
@Startup
public class ConfigBean {
    private static final Logger logger = Logger.getLogger(
                "boundless.ejb.ConfigBean");
    
    @EJB
    private AdminBean adminBean;
    private CriteriaBuilder cb;
    @PersistenceContext(unitName = "Boundless1.2PU")
    private EntityManager em;
    @EJB
    private RequestBean requestBean;

    @PostConstruct
    public void init() {
        cb = em.getCriteriaBuilder();
 
        // create Matt
        logger.info("Creating Matt entity");
        
        Account matt = new Account();
        matt.setFirstname("Matt");
        matt.setLastname("Krupin");
        matt.setEmail("mjkupin@gmail.com");
        matt.setUsername("boundsoft");
        matt.setPassword("boundless");
        
        
        logger.info("Calling createStudent() on Matt");
        String result = adminBean.createAccount(matt);
    }
}
